#ifndef WIDGET_H
#define WIDGET_H

#include <QWidget>
#include <QKeyEvent>
#include <QPainter>
#include <QPaintEvent>
#include <QPixmap>
#include <QDebug>

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public QWidget
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

private:
    void drawPixmapFunc();

    void paintEvent(QPaintEvent* p);
    void keyPressEvent(QKeyEvent* k);

private:
    Ui::Widget *ui;

    QPixmap* pix;
    QImage* image;

    //width 用来获取窗口的宽度， height用于高度， 而step表示步长
    int startx, starty, width, height, step;
};
#endif // WIDGET_H
